package demo1;

import java.util.*;

class Orange{
    int a;
    int b;
    Orange(){}
    Orange(int a, int b){
        this.a = a;
        this.b = b;
    }
}

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(), k = in.nextInt();
        Orange[] o = new Orange[n];
        for(int i = 0; i < n; i++){
            o[i] = new Orange();
            o[i].a = in.nextInt();
        }
        for(int i = 0; i < n; i++){
            o[i] = new Orange();
            o[i].b = in.nextInt();
        }

        Arrays.sort(o, (x, y) -> {
            if(x.b == y.b) { return x.a - y.a;}
            return y.b - x.b;
        });

        long x = 0, y = 0;
        for(int i = 0; i < k; i++){
            x += o[i].a;
            y += o[i].b;
        }
        System.out.println(x + " " + y);
    }
}
